<template>
	<view class="al">
		
	<form @submit="formSubmit" @reset="formReset" >
		<view class="for">
		<!-- <view class="content">
			<label class="lable">废钢碳含量%:</label>
			<input class="txt" type="text" v-model="form.fgChl" placeholder="请输入.." />
		</view> 
		
		<view class="content">
			<label class="lable">生铁碳含量%:</label>
			<input class="txt"   type="text" v-model="form.stChl" placeholder="请输入.." />
		</view>
		<view class="content">
			<label class="lable">回炉碳含量%:</label>
			<input class="txt"   type="text" v-model="form.hllChl" placeholder="请输入.." />
		</view> -->
		<view class="content">
			<label class="lable">*原铁水成分碳含量%:</label>
			<!-- <input class="txt"   type="text" v-model="form.cBz" placeholder="请输入.." /> -->
			<text    class="v_input"   >{{form.cBz}}</text>
		</view>
	<!-- 	<view class="content">
			<label class="lable">有效成分碳含量%:</label>
			<input  class="txt"  type="text" v-model="form.cYxcfhl" placeholder="请输入.." />
		</view>
		<view class="content">
			<label class="lable">原料吸收率碳含量%:</label>
			<input class="txt"   type="text" v-model="form.cXsl" placeholder="请输入.." />
		</view>
		
		
		<view class="content">
			<label class="lable">废钢硅含量%:</label>
			<input class="txt" type="text" v-model="form.fgSihl" placeholder="请输入.." />
		</view> 
		
		<view class="content">
			<label class="lable">生铁硅含量%:</label>
			<input class="txt"   type="text" v-model="form.stSihl" placeholder="请输入.." />
		</view>
		<view class="content">
			<label class="lable">回炉硅含量%:</label>
			<input class="txt"   type="text" v-model="form.hllSihl" placeholder="请输入.." />
		</view> -->
		<view class="content">
			<label class="lable">*原铁水成分硅含量%:</label>
			<!-- <input class="txt"   type="text" v-model="form.siBz" placeholder="请输入.." /> -->
			<text    class="v_input"   >{{form.siBz}}</text>
		</view>
		<!-- <view class="content">
			<label class="lable">有效成分硅含量%:</label>
			<input  class="txt"  type="text" v-model="form.siYxcfhl" placeholder="请输入.." />
		</view>
		<view class="content">
			<label class="lable">原料吸收率硅含量%:</label>
			<input class="txt"   type="text" v-model="form.siXsl" placeholder="请输入.." />
		</view> -->
		
			<view class="content">
				<label class="lable">废    钢:</label>
				<input  class="txt"  type="number" v-model="fg" placeholder="请输入.." />
			</view>
			
			<view class="content">
				<label class="lable">生    铁:</label>
				<input  class="txt"  type="number" v-model="st"  placeholder="请输入.." />
			</view>
			
			<view class="content">
				<label class="lable">配料重量:</label>
				<input  class="txt"  type="number" v-model="pl"  placeholder="请输入.."/>
			</view>
			<view class="blac"></view>
			<view class="content">
				<label class="lable">增碳剂加入量:</label>
				<label class="txtr"  >{{cadd}}</label>
			</view>
			<view class="content">
				<label class="lable">硅铁粒加入量:</label>
				<label class="txtr"  >{{siadd}}</label>
			</view>
		</view>
		
		<button form-type="submit" class="btn2">计算</button>
	</form>
		
	</view>
</template>

<script>
	import configService from '@/common/config.service.js';
	const apiUrl = configService.apiUrl;
	export default {
		data() {
			return {
				cBz:'',
				fg:'',
				st:'',
				pl:'',
				cadd:'0',
				siadd:'0',
				form:{
					cXsl:"",
					cYxcfhl:"",
					cBz:"",
					hllChl:"",
					stChl:"",
					fgChl:"",
					siXsl: "",
					siBz: "",
					siYxcfhl: "",
					hllSihl: "",
					stSihl: "",
					fgSihl: "",
				},
			}
		},
		mounted() {
			this.getdata();
		},
		onShow:function(e){
			this.$verify.verify();
		},
		methods: {
			getdata() {
				uni.request({
						url: apiUrl+'/dlplss/list',
						header: {
							'content-type': 'application/json' //自定义请求头信息
						},
						method : 'POST',
						data:{
							type : 1,
							deptId : uni.getStorageSync("deptId")
						},
						success: (res) => {
							if(res.statusCode === 200 && res.data.data.length > 0 ){
								this.form = res.data.data[0];
							}else{
								uni.showModal({
									title: '提示',  //提示标题
									content: '请维护电炉配料标准！',  //提示内容
									showCancel: true, //是否显示取消按钮
									success: function (res) {
										if (res.confirm) {  //confirm为ture，代表用户点击确定
											console.log('点击了确定按钮');
										} else if (res.cancel) {  //cancel为ture，代表用户点击取消
											console.log('点击了取消按钮');
										}
									}
								})		
							}
							// 
							// console.log(res);
							// this.form = res.data.data[0];
							// if(res.statusCode === 200)
							// {
							// 	self.Info = res.data;
							// }
						},
				});
				
			},
		    opera(val) {
			  let hl = this.pl-this.fg-this.st;
		      let midc =this.pl*val.cBz-this.fg*val.fgChl-this.st*val.stChl-hl*val.hllChl;
			 let midsi = this.pl*val.siBz-this.fg*val.fgSihl-this.st*val.stSihl-hl*val.hllSihl;
		      this.cadd = (midc/100/val.cYxcfhl*100/val.cXsl*100).toFixed(2);
				this.siadd = (midsi/100/val.siYxcfhl*100/val.siXsl*100).toFixed(2);
		    },
		    formSubmit(e) { 
		     if(this.form == null ){
					uni.showToast({
						 title: "请先维护电炉配料速算标准！",
						 icon:'error',
						 duration:1000
					})
				}
				this.opera(this.form);
		    },
		}
	}
</script>

<style>
	@import url("@/common/comcss.css");

</style>
